#include "Measurement_Events.h"
#include "usb_mes_an.h"
#include "stm32f10x_tim.h"

/* definition of dummy signals */
uint16_t signal_rect[24]={0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5};
uint16_t signal_tria[24]={0,1,2,3,4,5,6,7,8,9,10,11,12,11,10,9,8,7,6,5,4,3,2,1};

uint16_t dummy_val_1=0;
uint16_t dummy_val_2=0; 
uint8_t dummy_i=0;

/* External Symbols */
extern uint8_t mes_needed;

/* Cyclic measurement timer interrupt */
void TIM7_IRQHandler(void)
{
	/* dummy to get the next value */
	dummy_val_1=signal_rect[dummy_i];
	dummy_val_2=signal_tria[dummy_i];
	if (dummy_i < 23)
		dummy_i++;
	else 
		dummy_i=0;
	/* end dummy */

	/* trigger a measurement cycle */
	if(mes_needed == 1)
	{
		start_measurement();
	}

	TIM_ClearITPendingBit(TIM7,TIM_IT_Update);		/* Clear the flag at the end, otherwise this process could be interrupted by other interrupts with the same priotiy */

}
